<!-- 公共资源的导入 -->
<?php if (!has_templet()) { ?>

    <script src="/shop/templates/mg/js/onlineserver.js" type="text/javascript"></script>
    <script src="/shop/templates/mg/js/globals.js" type="text/javascript"></script>
    <script charset="utf-8" src="/shop/templates/mg/js/common.js"></script>
    <link rel="stylesheet" href="/shop/templates/mg/css/style.css" type="text/css" media=""/>
    <link rel="stylesheet" href="/shop/templates/mg/css/menu.css" type="text/css" media=""/>
    <link rel="stylesheet" href="/shop/templates/mg/css/mg.style.css">
    <link rel="stylesheet" href="/shop/templates/mg/css/mg.menu.css">
    <script charset="utf-8" src="/shop/templates/mg/js/wpa.js"></script>
    <script src='/data/resource/js/jquery.lazyload.min.js'></script>

    <style>
        #faq {
            display: none;
        }


    </style>

    <?php
    $web_config = Model('setting')->getListSetting();
}

?>

<?php
if(get_template_type() == 'header'){
?>
<div id="header">

        <div class="top_nav_bg">
            <div class="top_nav1">
                <div class="top_link fix">
                    <div class="login_re">
                        您好，欢迎访问<?php echo $web_config['site_name']?>！
                     </div>
<!--                    <div class="top_linkLeft"><span id="site">深圳</span>-->
<!--                        <div class="drops" id="drops"></div>-->
<!--                        <input id="Hidd_SiteId" type="hidden" value="-1"/>-->
<!--                    </div>-->

                    <div class="link_list">
                    	<div class="lg-bar">
                    	    <?php if(isset($_SESSION['member_id'])){ ?>
                            您好，<?php echo $_SESSION['member_name']?>
                            <a href="/shop/index.php?act=member&op=home">[个人中心]</a>
                            <a href="/shop/?act=login&op=logout" id='logout'>[退出]</a>
                            <script >
                            $('#logout').click(function(){
                                $.post("/shop/index.php?act=login&op=logout",function(msg){
                                    location.reload();
                                })
                                return false;
                            })
</script>
                            <?php
                    	        }else{
                    	    ?>
                    	    <a id="Default_ctl00___linkMyAccount" href="/shop/index.php?act=login&op=register">注册</a><a id="Default_ctl00___Common_Link_Login1" href="/shop/index.php?act=login">登录</a>
                    	    <?php } ?>

                        </div><span>|</span>
                        <?php if($_SESSION['store_id']){ ?>
                         <span>
                            <a href="/shop/index.php?act=seller_center">商家中心</a>
                         </span>
                         <?php }else{ ?>
                         <span>
                            <a href="/shop/index.php?act=show_joinin&op=index">商家申请</a>
                         </span>
                         <?php } ?>
                         <span >|</span>

                         <span><a href="/wap/" rel="nofollow"><span class="line"></span><s class="icon_mobile"></s>手机易海购跨境电商平台</a></span>

                        <span >|</span>

                        <div  class="dorpdown qc-dorpdown">
                        	<div class="dor-dt fix"><i class="dor-icon"></i><div class="dor-tit">关注<?php echo $web_config['site_name']?></div></div>
                            <div class="dor-con">
                            	<div class="qc-item last fix">
                            	<?php
                            	    $ad = tpl_get("二维码");
                            	?>
                                	<div class="qc-img"><img src="<?php echo $ad['pic']?>" class="img-responsive"><p>关注<?php echo $web_config['site_name']?></p></div>

                                </div>
                            </div>
                        </div>

                        <span>|</span>
                        <span>
                            <a id="Default_ctl00___SiteUrl4" href="/shop/index.php?act=article&op=article&ac_id=35">帮助中心</a></span>
                            <span>|</span>
                              <span><div id="shoucang" style='margin-right: -20px;'><div class="ad_custom cssEdite" type="custom" id="ads_28" ><a href="javascript:favPage();">收藏商城</a></div>
</div></span>
                    </div>
                </div>
            </div>
        </div>
        <div class="display_no"> <div class="ad_custom cssEdite" type="custom" id="ads_17" ><!-- JiaThis Button BEGIN --> <div class="jiathis_style"><span class="jiathis_txt">加关注：</span> <a class="jiathis_button_tsina"></a><a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">分享</a> </div>
<!-- JiaThis Button END --></div>
</div>
        <div class="header1_p1 fix">
            <div class="logo">
                <div class="logo cssEdite" type="logo" id="logo_1" >
                <?php
                    $ad = tpl_get("logo");
                ?>
<a href="<?php echo $ad['link']?>">
<img style="width:300px;height:77px;" src="<?php echo $ad['pic']?>" />
</a>
</div>

            </div>

         <div class="jf_ad1"><div class="adv_image cssEdite" type="image" id="ads_2" >
<a target="_blank"><img src="/shop/templates/haidao/pictures/20150626173739_1546.jpg" /></a>
</div>
</div>
         <div class="jf_ad3">
               <div class="search_tab">
                <div class="search">
<form action="/shop/index.php">
    <input type="hidden" name="act" value="search">
    <input type="text" name="keyword" id="txt_Search_Keywords" class="search_input" />
    <input type="submit" value="搜索"  class="search_btn" />
</form>

                </div>
            </div>
            <?php
            $config = Model('setting')->getListSetting();

            ?>
            <div class="remen"><label>热门搜索：</label><ul class="keyword cssEdite" type="keyword" id="comments_4" >
            <?php
                foreach(explode(',',$config['hot_search']) as $item){
                ?>
                <li>
                <a href="/shop/?act=search&keyword=<?php echo $item;?>"><?php echo $item;?></a>
</li>
                <?php
                }
            ?>
</ul>
</div>

         </div>

        </div>
        <div class="nav_bg nobor">
            <div class="nav1">
          <div class="side_nav">
                    <h3 class="title">
                        <a id="Default_ctl00___SiteUrl5" href="/index.php">
                        所有商品分类</a>
                    </h3>

                    <div class="my_left_category">

                    <?php
                        $cat_1 = Model('goods_class')->getGoodsClassListByParentId(0);
                        foreach($cat_1 as $cat1){
                            $cat_2 = Model('goods_class')->getGoodsClassListByParentId($cat1['gc_id']);
                    ?>
                    	    <div class="my_left_cat_list">
            <div id='twoCategory_5000000' class="h2_cat" >

                <ul class="new-subcate">
                    <li> <a href='/shop/?act=search&op=index&cate_id=<?php echo $cat1['gc_id']?>'><b><?php echo $cat1['gc_name']?></b></a> </li>
                    <?php
                        foreach($cat_2 as $k => $cat2){
                        if($k == 3){ break; }
                    ?>
                    <li>
                    <a href="/shop/?act=search&op=index&cate_id=<?php echo $cat2['gc_id']?>"><?php echo $cat2['gc_name']?></a>
</li>
                    <?php
                        }
                    ?>


                </ul>
                <div class="h3_cat" id='threeCategory_5000000'>
                     <div class="shadow">
                        <div class="shadow_border">

                            <span class="category" >

                            <?php
                                foreach($cat_2 as $cat2){
                            ?>
                                                                  <div class="fenlei_jianduan">
                                             <h4>
                                                <a href='/shop/?act=search&op=index&cate_id=<?php echo $cat2['gc_id']?>'><?php echo $cat2['gc_name']?></a>
                                             </h4>

                                            <div class="fthree">
                                               <ul>
                                               <?php
                                                $cat_3 = Model('goods_class')->getGoodsClassListByParentId($cat2['gc_id']);
                                                foreach($cat_3 as $cat3){
                                                ?>
                                                 <li>
                                                         <a href='/shop/?act=search&op=index&cate_id=<?php echo $cat3['gc_id']?>'><?php echo $cat3['gc_name']?></a>
                                                       </li>
                                                <?php
                                                }
                                               ?>


                                               </ul>
                                             </div>
                                         </div>

                            <?php
                                }
                            ?>
  			                 </span>
					    </div>
				     </div>
			</div>
		</div>
		</div>

                    <?php
                    }
                    ?>

                    </div>
                </div>

                <div class="main_nav" id="ty_menu_title">
                    <ul>
                        <?php
                        $nav = get_nav();
                        foreach($nav as $key => $val){
                            if(!is_array($val)){
                            ?>
                            <li>
                                <a href="/">
                                    <span><?php echo $val;?></span>
                                </a>
                            </li>
                            <?php
                            }
                            else {
                                foreach ($val as $v) {
                                ?>
                                <li>
                                    <a href="<?php echo $v['nav_url'] ?>">
                                    <span>
                                        <?php
                                            echo $v['nav_title'];
                                        ?>
                                    </span>
                                    </a>
                                </li>
                                <?php
                                }
                            }
                        }
                        ?>
                    </ul>


                </div>



            </div>
        </div></div>




<script type="text/javascript">
	   function Showxinren_tab() {
		   document.getElementById("xinren_tab").style.display = "block";
	   }

	   function Hiddenxinren_tab() {
		   document.getElementById("xinren_tab").style.display = "none";
	   }
</script>

            <script>
                var currenturl = location.href.substr(location.href.lastIndexOf('/') + 1, location.href.length - 20);
                if (currenturl != "Desig_Templete.aspx?skintemp=default") {
                    $(".side_nav").hover(function () {
                        $(".my_left_category").css({ 'display': 'block' });
                    }, function () {
                        $(".my_left_category").css({ 'display': 'none' });
                    });
                }
				// $(function(){
						$(".h2_cat").each(function(){
					        $(this).hover(function(){
					           if($(this).hasClass('active_cat')){
					                $(this).removeClass("active_cat");
					            }else{
					                $(this).addClass('active_cat');
					            }
					        });
					    });

					//购物车 数量为0时 不显示
					function toggleCartNum(){
						var $cartNum = $("#cart-num");
						var val = parseInt($cartNum.text());
						if(val){
							$cartNum.show();
						}
					}
					toggleCartNum();
						//})
//左侧导航start
$(function(){
	function setHeight(){
		height = $('.my_left_category').height();
		$('.shadow_border').height(height+2);
	};
	$('.my_left_category>div').filter('.my_left_category>div:gt(6)').hide ();
	$('.my_left_category>div').filter ('.my_left_category>div:nth-child(14)').mouseover(function(){
		$(this).siblings ('.my_left_category>div:gt(6)').show();
		setHeight();
	})
	$('.my_left_category>div').filter ('.my_left_category>div:nth-child(14)').mouseout(function(){
		$(this).siblings ('.my_left_category>div:gt(6)').hide();
		setHeight();
	})
	$('.my_left_category>div').filter ('.my_left_category>div:nth-child(14)').siblings ('.my_left_category>div:gt(6)').mouseover(function(){
		$('.my_left_category>div').filter ('.my_left_category>div:nth-child(6)').siblings ('.my_left_category>div:gt(6)').show();
		setHeight();
	})
	$('.my_left_category>div').filter ('.my_left_category>div:nth-child(14)').siblings ('.my_left_category>div:gt(6)').mouseout(function(){
		$('.my_left_category>div').filter ('.my_left_category>div:nth-child(14)').siblings ('.my_left_category>div:gt(6)').hide();
		setHeight();
	})
});
//左侧导航over
    </script>
    <script src="/shop/templates/mg/js/switchsite.js" type="text/javascript"></script>
    </div>




<?php } ?>

<?php if (get_template_type() == 'index') { ?>

    <div class="main_index" id="main_index">

        <div class="mainlunbo">

            <!--新加的新闻部分-->
            <div class="ad_custom cssEdite" type="custom" id="ads_11">
                <?php
                $focus = Model('web')->where(array('web_id' => 101))->find();
                $html = $focus['web_html'];
                $dom = new DOMDocument();
                $dom->loadHTML($html);
                $lis = $dom->getElementsByTagName('li');

                $arr = array();
                for ($i = 0; $i < $lis->length; $i++) {
                    $li = $lis->item($i);
                    $style = $li->getAttribute('style');
                    $a = $li->getElementsByTagName('a');
                    $arr[] = array(
                        'link' => $a->item(0)->getAttribute('href'),
                        'pic' => preg_replace("/^.+?style=\"(.+?)\".+?$/", "$1", $style),

                    );

                }
                ?>

                <div class='banner_wrapper' style='height:450px'>
                    <div class='banner'>
                        <?php
                        $web = Model('web')->getby_web_page('index_pic');
                        echo $web['web_html'];
                        ?>
                    </div>
                </div>
		<script src="/shop/templates/mg/js/jquery.js"></script>
                <script src="/shop/resource/js/home_index.js"></script>
                <!-- And the relevant JavaScript -->
            </div>

        </div>
        <div class="main1 fix">
            <div class="box1 mt20">
                <table class="banner-table" cellpadding="0" cellspacing="0">
                    <tr>
                        <?php
                        $middle_banner = tpl_get("中部广告位");
                        foreach ($middle_banner as $pic) { ?>
                            <td>
                                <div class="adv_image cssEdite" type="image" id="newads_002"><a href='<?php echo $pic['link'] ?>' target="_blank" class="mg-pic-box">
                                 <?php if(!empty($pic['goods_name'])){?>
                                    <div class="adv_image_title">
                                        <?php echo $pic['goods_name']; ?>
                                    </div>
                                 <?php } ?>
                                <img src="<?php echo $pic['pic']; ?>" data-original="<?php echo $pic['pic'] ?>" class="lazyload"/></a></div>
                            </td>
                        <?php } ?>

                    </tr>
                </table>
            </div>

            <div class="activity">
                <div class="floor_hd">
                    <div class="title cssEdite" type="title">
                        <span class="title">活动版块</span>
                    </div>
                </div>
                <div class="floor-main">
                    <ul>
                        <?php
                        $activity_banner = tpl_get("活动展示位");
                        foreach ($activity_banner as $act_pic) { ?>
                            <li>
                                <a href="<?php echo $act_pic['link'] ?>">
                                    <img class="lazyload" src="<?php echo $act_pic['pic']; ?>" data-original="<?php echo $act_pic['pic'] ?>" alt="">
                                </a>
                            </li>
                        <?php } ?>

                    </ul>
                </div>
            </div>



            <?php $floor = tpl_get("楼层");
            foreach ($floor as $key => $item) {
                ?>
                <div class="floor floor-<?php echo $key + 1; ?>" id="floor-<?php echo $key + 1; ?>">
                    <div class="floor_hd" style="color:<?php echo $item['color'] ?> !important;border-bottom-color:<?php echo $item['color'] ?> !important;border-color: <?php echo $item['color'] ?> !important;">
                        <div class="title cssEdite" type="title">
                            <div><span class="icon"></span><span
                                    class="title"><?php echo $item['floor_name'] ?></span></div>
                        </div>
                        <div class="morelink" type="morelink"><a href="<?php echo $item['more'] ?>">更多 ></a>
                        </div>
                    </div>
                    <div class="floor-main">
                        <?php $images = $item['images']; ?>

                        <div data-bind="foreach : floor_items">

                            <div class="floor" data-bind="with : images" data-index="05126378">
                                <ul>
                                    <li>
                                        <div class="floor-cate">
                                            <?php $hot_cata_arr = explode(',',$item['floor_hot_cate']); ?>

                                            <?php for($i=0;$i<7;$i++){?>
                                                <?php if(!empty($hot_cata_arr[$i])){?>
                                                    <?php $son_cate_arr = explode(':',$hot_cata_arr[$i])?>
                                                    <?php if(is_numeric($son_cate_arr[1])){?>
                                                        <a class="hot-cate" href="index.php?act=search&op=index&cate_id=<?php echo $son_cate_arr[1]?>"><?php echo $son_cate_arr[0]?></a>
                                                    <?php } ?>
                                                <?php }else{ break;} ?>

                                            <?php } ?>


                                        </div>
                                        <a class="floor-item-spc" href="<?php echo $images[0]['link'] ?>" target="_blank">
                                            <div class="big-gtitle">
                                                <?php echo $images[0]['goods_name'] ?>
                                            </div>
                                            <div class="big-gdes">
                                                <?php echo $images[0]['des'] ?>
                                            </div>
                                            <div class="big-pic-box">
                                                <img src="<?php echo $images[0]['pic'] ?>" link="<?php echo $ii-1;?>">
                                            </div>
                                        </a>
                                    </li>

                                    <?php for($i=1;$i<5;$i++){?>
                                        <?php $ii = $i*2;?>
                                        <li>
                                            <a href="<?php echo $images[$ii-1]['link'] ?>" target="_blank">
                                                <div class="gtitle">
                                                    <?php echo $images[$ii-1]['goods_name'] ?>
                                                </div>
                                                <div class="gdes">
                                                    <?php echo $images[$ii-1]['des'] ?>
                                                </div>
                                                <div class="pic-box">
                                                    <img src="<?php echo $images[$ii-1]['pic'] ?>" link="<?php echo $ii-1;?>">
                                                </div>
                                            </a>
                                            <a href="<?php echo $images[$ii]['link'] ?>" target="_blank">
                                                <div class="gtitle">
                                                    <?php echo $images[$ii]['goods_name'] ?>
                                                </div>
                                                <div class="gdes">
                                                    <?php echo $images[$ii]['des'] ?>
                                                </div>
                                                <div class="pic-box">
                                                    <img src="<?php echo $images[$ii]['pic'] ?>" link="<?php echo $ii;?>">
                                                </div>
                                            </a>
                                        </li>
                                    <?php  }?>



                                </ul>
                            </div>
                        </div>
                    </div>


                </div>
                <!--                <div style="height:15px;"></div>-->
                <?php
            }
            ?>

        </div>
        <script type="text/javascript" src="/shop/templates/mg/js/slider.js"></script>
        <script type="text/javascript">

            $(function () {
                //猜你喜欢 滑动
                $('#swiper-container').flexslider({
                    animation: "slide",
                    direction: "horizontal",
                    easing: "swing",
                    directionNav: false,
                    animationLoop: true,
                    slideshowSpeed: 5000, // 自动播放速度毫秒
                    animationSpeed: 200 //滚动效果播放时长
                });
                //关闭 头部 广告
                $("#guild-close").bind("click", function () {
                    $(this).parents(".guild-wrap").hide();
                })
                //图片懒加载
                $("img.lazyload").lazyload({failure_limit: 1});
                //顶部间隙
                var mt = $(window).height() / 2;
                var $floor = $(".floor:not(.fav-floor)");

                function setFloor() {
                    var top = $(window).scrollTop();
                    var winH = $(window).height();
                    var theme = "hover";
                    //判断 到 哪一个楼层
                    $floor.each(function (index, element) {
                        var offset = $(this).offset();
                        var arr = $(this).attr("class").split(" ");
                        var sp = offset.top - mt;
                        if (top >= sp) {
                            var $curFloor = $("#tb-wrap .tb-flr[data-sc=" + arr[1] + "]");
                            $curFloor.addClass(theme).siblings().removeClass(theme);
                            return;
                        }
                    });
                }

                var scInter;
                //滚动
                $(window).bind("scroll.tb", function () {
                    var $tbWrap = $("#tb-wrap");
                    var scrooltop = $(this).scrollTop();
                    var winH = $(window).height();
                    var top = $(".floor-1").offset().top;
                    if ((scrooltop + winH) >= top) {
                        $tbWrap.show();
                    } else {
                        $tbWrap.hide();
                    }
                    if (scInter) {
                        window.clearTimeout(scInter);
                    }
                    scInter = window.setTimeout(setFloor, 0);
                })
                // 右侧工具条
                $("#tb-wrap a").bind("click", function () {
                    var st = 0;
                    var sc = $(this).attr("data-sc");
                    if (sc == "top") {

                    } else {
                        var $floor = $("." + sc);
                        var offset = $floor.offset();
                        st = offset.top - mt + 1;
                        if (st < 0) {
                            st = 0;
                        }
                    }
                    $('html,body').stop().animate({scrollTop: st}, 200);
                })
            })
        </script>
        <script type="text/javascript">
            var pageindex = 0;
            function HuanClicek() {
                pageindex++;
                $.ajax({
                    type: "get",
                    url: "/Common_Default_ProductList_AJAX.aspx",
                    data: {pageIndex: pageindex},
                    success: function (data) {
                        $("#common_default_productlist").html(data);
                        if ($("#common_default_productlist table td").length != 6) {
                            pageindex = -1;
                            HuanClicek();
                        }
                    },
                    error: function () {
                        alert("error");
                        pageindex--;
                    }
                });
            }</script>
        <script type=text/javascript>
            var _c = _h = 0;
            $(function () {
                $('#play > li').click(function () {
                    var i = $(this).attr('alt') - 1;
                    clearInterval(_h);
                    _c = i;
                    play();
                    change(i);
                })
                $("#pic div").hover(function () {
                    clearInterval(_h)
                }, function () {
                    play()
                });
                play();
            })
            function play() {
                _h = setInterval("auto()", 6000);
            }
            var tit;
            function change(i) {
                var $curLi = $("#li" + i);
                $curLi.addClass("active").siblings().removeClass("active");
                var $curItem = $("#pic a").eq(i);
                var $siblings = $curItem.siblings();
                var theme = "active-ele";
                $siblings.removeClass(theme).stop().animate({opacity: 0}, 500);
                $curItem.stop().animate({opacity: 1}, 500, function () {
                    window.clearTimeout(tit);
                    tit = window.setTimeout(function () {
                        $curItem.addClass(theme);
                    }, 10);
                });
            }
            function auto() {
                var length = $("#play li").length;
                _c = _c > length ? 0 : _c + 1;
                change(_c);
            }

        </script>
    </div>

    <div class="floor-fix-nav">
        <?php foreach($floor as $kkk=>$vvv ){ ?>
            <a href="#floor-<?php echo $kkk + 1; ?>"><?php echo $vvv['floor_name'] ?></a>
        <?php } ?>
    </div>
    <script>
        $(window).scroll(function(){
            var top = document.body.scrollTop;
            if(top>500) {
                $('.floor-fix-nav').show();
            }else{
                $('.floor-fix-nav').hide();
            }
        })
        $('.floor-fix-nav a').click(function(){
            $(this).siblings().removeClass('active');
            $(this).addClass('active');
        })
    </script>
<?php } ?>

<?php if (get_template_type() == 'footer') { ?>
    <link rel="stylesheet" href="/shop/templates/mg/css/footer.css">

    <div id="footer">


        <div class="site-nav">
            <div class="site-nav-inner">

                <ul class="site-nav-r">


                </ul>
            </div>
        </div>

        <div class="copyright">
            <?php
            $m = Model('setting');
            $config = $m->getListSetting();
            echo html_entity_decode($config['icp_number'], ENT_QUOTES);
            ?>
			</a>
        </div>

        <script>
            $('.site-nav-r').append($('#faq li'));

            $('.copyright').prepend($($('.footer_link')[0].outerHTML).show()).css({
                height: 'auto'
            });
        </script>
    </div>
<?php } ?>
